<template>
	<view>
		<!-- <up-navbar leftIcon="" autoBack bgColor="transparent" title="选择角色"></up-navbar> -->
		<view class="my-bg">
			<view class="bg-white pad-left-right-60 pad-top-bottom-30 radius20 mar-top-120">
				<view @click="hanldeLogin('user')" class="button-style">我是用户</view>
				<view @click="hanldeLogin('worker')" class="button-style mar-top-60">我是抄表员</view>
			</view>
		</view>

	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import { onShow } from '@dcloudio/uni-app';

	const hanldeLogin = (type) => {
		if (type == 'user') {
			uni.navigateTo({
				url: '/pages/login/login'
			})
		} else {
			uni.navigateTo({
				url: '/pages/meterReaderLogin/meterReaderLogin'
			})
		}
	}

	// 页面显示
	onShow(() => {
		if (uni.getStorageSync('loginStatus') == 'worker') {
			uni.reLaunch({
				url: '/pages/index/index'
			})
		} else if (uni.getStorageSync('loginStatus') == 'user') {
			uni.reLaunch({
				url: '/pages/userAdmin/userAdmin'
			})
		}
	})
</script>

<style scoped>
	.my-bg {
		/* background-image: url('/static/image/my-bg.png'); */
		background-image: url('https://file.jitoushuizhan.cn/upload/2025/02/03/111ba83702f882f08421c066eb85f6f6.png');
		background-size: 100% 489rpx;
		background-color: #F7F8FA;
		background-repeat: no-repeat;
		min-height: 100vh;
		box-sizing: border-box;
		padding: 100rpx 60rpx 0 60rpx;
	}

	.avatar {
		width: 110rpx;
		height: 110rpx;
		border-radius: 50%;
	}

	.button-style {
		padding: 20rpx 0;
		box-sizing: border-box;
		text-align: center;
	}
</style>